package servlets;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dto.OfertaDTO;

import business.LaCorunaDelegator;

/**
 * Servlet implementation class for Servlet: OfadManager
 *
 */
 public class OfadManager extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   private static final String OFAD_PAGE = "/WEB-INF/jsp/listado_ofads.jsp";
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public OfadManager() {
		super();
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		   LaCorunaDelegator delegator= LaCorunaDelegator.getInstance();
		   List<OfertaDTO> ofads= delegator.getListdoOFAD();
		   request.setAttribute("ofads", ofads);
		   getServletContext().getRequestDispatcher(OFAD_PAGE).forward(request, response);
	}  	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}   	  	    
}